<?php

/*
 *Copyright (C), WhiteBlue
 *File name: config.php
 *Author: Version: 2015.3.9
 *Description: 配置文件加载与获取
 */

function config($key, $value = null)
{
    static $_config = array();
    if (isset($value)) {
        $_config[$key] = $value;
        return null;
    } else {
        if (isset($_config[$key]))
            return $_config[$key];
        else
            throw new ErrorException('config not find');
    }
}


$configs = require('./app/config/config.php');

foreach ($configs as $key => $value) {
    config($key, $value);
}